import request from '@/utils/request';
import { stringify } from 'qs';
/**s
 * 查询课表详情
 * @param {*} params 
 */
export async function classTableInfoList(params) {
  return request('/classTableInfo/list', {
    method: 'POST',
    data: { ...params },
  });
}

/**
 * 根据课表查询课表具体排期详情
 * @param {*} params 
 */
export async function queryMemberBookingCourseInfoByClassId(params) {
  return request('/classTableInfo/queryMemberBookingCourseInfoByClassId', {
    method: 'POST',
    data: { ...params },
  });
}

/**
 * 查询名称或手机号查询会员
 * @param {*} params 
 */
export async function fetchMembersList(params) {
  return request('/member/selectMember', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 会员签到根据场馆查询会员卡种类
 * @param {*} params 
 */
export async function getMemberCard(params) {
  return request('/bookingCourse/getMemberCardAppointment', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 保存预约
 * @param {*} params 
 */
export async function saveBookingCourse(params) {
  return request('/bookingCourse/saveBookingCourse', {
    method: 'POST',
    data: {
      ...params
    },
  });
}


/**
 * 确认签到
 * @param {*} params 
 */
export async function saveMemberSigned(params) {
  return request('/bookingCourse/saveMemberSigned', {
    method: 'POST',
    data: { ...params },
  });
}

/**
 * 取消预约
 * @param {*} params 
 */
export async function cancelSign(params) {
  return request('/bookingCourse/cancel', {
    method: 'POST',
    data: { ...params },
  });
}

/**
 * 根据用户信息查询场馆List
 * @param {*} params 
 */
export async function fetchShopList(params) {
  return request('/venueInfo/queryVenueInfoListByUserId', {
    method: 'POST',
    requestType:'form',
    data: { ...params },
  });
}

/**
 * 根据当前登录人查询教练List
 * @param {*} params 
 */
export async function fetchCoach(params) {
  return request('/sys/user/queryCoachAndSale', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 查询课程表信息
 * @param {*} params 
 */
export async function queryClassTableInfoById(params) {
  return request('/classTableInfo/list', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 删除课表信息
 * @param {*} params 
 */
export async function deleteClassTableInfoById(params) {
  return request(`/classTableInfo/delete?${stringify(params)}`);
}

/**
 * 根据课表id查询支持会员卡
 * @param {*} params 
 */
export async function queryAllCardByCourseId(params) {
  return request('/classTableInfo/queryAllCardByCourseId', {
    method: 'POST',
    requestType:'form',
    data: {
      ...params
    },
  });
}

/**
 * 根据课表id，添加支持会员卡
 * @param {*} params 
 */
export async function saveSetCardByCourseId(params) {
  return request('/classTableInfo/saveSetCardByCourseId', {
    method: 'POST',
    data: params,
  });
}

/**
 * 获取时间段List
 * @param {*} params 
 */
export async function fetchTimeList(params) {
  return request('/bookingCourse/queryAppointmentTimeList', {
    method: 'POST',
    requestType:'form',
    data: params,
  });
}

/**
 * 查询场地信息列表不分页，根据场馆id
 * @param {*} params 
 */
export async function querySiteInfoListByVenueIdNotPage(params) {
  return request(`/siteInfo/querySiteInfoListByVenueIdNotPage?${stringify(params)}`);
}

export async function queryUsableSiteInfoList(params) {
  return request('/siteInfo/queryUsableSiteInfoList', {
    method: 'POST',
    data: params,
  });
}